<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('钱宝官品交易信息列表')" />
    <style>
        #content {
            position:absolute;
            top:0;
            bottom:0;
            left:0;
            right:0;
            margin:auto;
            height:440px;
            width:70%;
            background: #346FCE;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <input type="hidden" name="isShow" th:value="${isShow}">
                <div class="select-list">
                    <ul>
                        <li>
                            <label style="width: 120px">品牌名称：</label>
                            <select name="manuNum" >
                                <option value="">选择品牌</option>
                                <option th:each="m:${manufacturer}" th:text="${m.MANU_NAME}" th:value="${m.MANU_NUM}"></option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 120px;">交易流水号：</label>
                            <input type="text" name="serial"/>
                        </li>
                        <li>
                            <label style="width: 120px;">渠道参考号：</label>
                            <input type="text" name="rrno"/>
                        </li>
                        <li>
                            <label style="width: 120px;">商户名称：</label>
                            <input type="text" name="mername"/>
                        </li>
                        <li>
                            <label style="width: 120px;">系统商户号：</label>
                            <input type="text" name="terno"/>
                        </li>
                        <li>
                            <label style="width: 120px;">渠道商户号：</label>
                            <input type="text" name="merno"/>
                        </li>
                        <li>
                            <label style="width: 120px;">SN：</label>
                            <input type="text" name="sn"/>
                        </li>
                        <li>
                            <label style="width: 120px;">渠道服务商编号：</label>
                            <input type="text" name="agentno"/>
                        </li>
                        <li>
                            <label style="width: 120px;">本地服务商编号：</label>
                            <input type="text" name="agentNum"/>
                        </li>
                        <li>
                            <label style="width: 120px;">交易类型：</label>
                            <select name="msgtype">
                                <option value="">所有</option>
                                <option value="H007">消费</option>
                                <option value="H302">银联二维码</option>
                                <option value="H202">微信</option>
                                <option value="H201">支付宝</option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 120px;">卡类型：</label>
                            <select name="cardtype">
                                <option value="">所有</option>
                                <option value="1">借记卡</option>
                                <option value="2">贷记卡</option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 120px;">扣费类型：</label>
                            <select name="chargeType">
                                <option value="">所有</option>
                                <option value="0">默认</option>
                                <option value="1">服务费</option>
                                <option value="2">流量费</option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 120px;">终端类型：</label>
                            <select name="posType" th:with="type=${@dict.getType('terminal_type')}">
                                <option value="">请选择</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 120px;">查询类型：</label>
                            <select name="queryType">
                                <option value="1">团队</option>
                                <option value="2">个人</option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label style="width: 120px;">交易日期：</label>
                            <input type="text" class="time-input" readonly th:value="${start}"  placeholder="开始时间" name="start"/>
                            <span>-</span>
                            <input type="text" class="time-input" readonly th:value="${end}" placeholder="结束时间" name="end"/>
                        </li>

                        <li>
                            <label style="width: 10px;"></label>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 search-collapse">
            <span style="color:blue">[</span>
            <span style="color: blue;font-style: initial">交易总笔数：</span>
            <span id="counten" style="color: red;font-style: initial">0</span><span style="color: blue;font-style: initial"> 笔</span>
            <span style="color:blue">]</span>
            <span style="color:blue">[</span>
            <span style="color: blue;font-style: initial">交易商户数：</span>
            <span id="mercount" style="color: red;font-style: initial">0</span><span style="color: blue;font-style: initial"> 个</span>
            <span style="color:blue">]</span>
            <span style="color:blue">[</span>
            <span style="color: blue;font-style: initial">交易总金额：</span>
            <span id="amount" style="color: red;font-style: initial">0.00</span><span style="color: blue;font-style: initial"> 元</span>
            <span style="color:blue">]</span>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <!-- <a class="btn btn-primary single" onclick="audit()" shiro:hasPermission="bankExpenditure:gbTradeInfo:sync">
                 <i class="fa fa-edit"></i> 推送交易分润
             </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="bankExpenditure:bankExpenditure:exportGb">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" class="table text-nowrap"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('bankExpenditure:gbTradeInfo:edit')}]];
    var removeFlag = [[${@permission.hasPermi('bankExpenditure:gbTradeInfo:remove')}]];
    var terminalTypeDatas = [[${@dict.getType('terminal_type')}]];

    var prefix = ctx + "bankExpenditure/gbTradeInfo";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "交易信息",
            firstLoad:false,
            responseHandler:responseHandler,
            clickToSelect:true,
            columns: [{
                radio: true
            },
                {
                    field: 'serial',
                    title: '交易流水号'
                },
                {
                    field: 'rrno',
                    title: '渠道参考号',
                },
                /*{
                    field: 'terno',
                    title: '系统商户号'
                },*/
                {
                    field: 'merno',
                    title: '渠道商户编号'
                },
                {
                    field: 'mername',
                    title: '商户名称',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value,5);
                    }
                },
                {
                    field: 'manuName',
                    title: '品牌名称'
                },
                {
                    field: 'sn',
                    title: '终端号'
                },
                {
                    field: 'posType',
                    title: '机具类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(terminalTypeDatas, value);
                    },
                },
                {
                    field: 'agentno',
                    title: '渠道服务商编号'
                },
                {
                    field: 'agentNum',
                    title: '本地服务商编号'
                },
                {
                    field: 'localdate',
                    title: '交易时间',
                    formatter: function (value, row, index) {
                        return value + " " + row.localtime;
                    }
                },
                {
                    field: 'msgtype',
                    title: '交易类型',
                    formatter: function (value, row, index) {
                        if ("H007" == value) {
                            return '<span style="color:blue;">消费</span>';
                        } else if ("H202" == value) {
                            return '<span style="color:red;">微信</span>';
                        } else if ("H302" == value) {
                            return '<span style="color:blue;">银联二维码</span>';
                        } else if ("H201" == value) {
                            return '<span style="color:blue;">支付宝</span>';
                        } else {
                            return "未知";
                        }
                    }
                },
                {
                    field: 'cardtype',
                    title: '卡类型',
                    formatter: function (value, row, index) {
                        if ("1" == value) {
                            return '<span style="color:blue;">借记卡</span>';
                        } else if ("2" == value) {
                            return '<span style="color:red;">贷记卡</span>';
                        } else {
                            return "暂无";
                        }
                    }
                },
                {
                    field: 'pan',
                    title: '交易卡号'
                },
                {
                    field: 'amount',
                    title: '交易金额(元)'
                },
                /* {
                     field: 'isysf',
                     title: '优惠标识',
                     formatter: function (value, row, index) {
                         if ("0" == value) {
                             return '<span style="color:red;">否</span>';
                         } else if ("1" == value) {
                             return '<span style="color:green;">是</span>';
                         } else {
                             return '<span style="color:blue;">暂无</span>';
                         }
                     }
                 },*/
                {
                    field: 'chargeType',
                    title: '扣费类型',
                    formatter: function (value, row, index) {
                        if ("0" == value) {
                            return '<span style="color:blue;">默认</span>';
                        } else if ("1" == value) {
                            return '<span style="color:red;">服务费</span>';
                        } else if ("2" == value) {
                            return '<span style="color:red;">流量费</span>';
                        } else {
                            return "暂无";
                        }
                    }
                },
                {
                    field: 'chargeMoney',
                    title: '扣费金额元'
                },
                {
                    field: 'charge',
                    title: '手续费'
                },
                {
                    field: 'chargeFj',
                    title: '附加费'
                },
                /*,
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.serial + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.serial + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
        };
        $.table.init(options);
    });

    function responseHandler(res) {
        $("#counten").text(res.data.PAY_COUNT);
        $("#amount").text(res.data.AMOUNT);
        $("#mercount").text(res.data.MER_COUNT);
    }

    function audit() {
        var merno = $.table.selectColumns("merno")[0];
        var msgtype = $.table.selectColumns("msgtype")[0];
        var serial = $.table.selectColumns("serial")[0];
        var rrno = $.table.selectColumns("rrno")[0];
        $.modal.confirm("确认要推送吗", function () {
            var url = prefix + "/sync";
            var data = {"merno": merno,"msgtype": msgtype,"serial": serial,"rrno": rrno};
            $.operate.post(url, data);
        });
    }
</script>
</body>
</html>
